/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FarmacieManagers;

import FarmacieDALManagers.*;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Administrator
 */
public class FarmacieDALManager {
   
    private static FarmacieDALManager instance;
    private EntityManagerFactory entityManagerFactory;
    
    public FarmacieDALManager getInstance(){
        
        if(instance == null)
        {
            instance = new FarmacieDALManager();
        }
        
        return instance;
    }
    
    private FarmacieDALManager(){
        entityManagerFactory = Persistence.createEntityManagerFactory("FarmacieDALPU");
    }
    
    private ArhivaManager arhivaManager;
    private ChitantaManager chitantaManager;
    private DetaliiChitantaManager detaliiChitantaManager;
    private DetaliiRetetaManager detaliiRetetaManager;
    private MedicamentManager medicamentManager;
    private ProducatoriManager producatoriManager;
    private RetetaManager retetaManager;
    private StocuriManager stocuriManager;
    private SubstantaActivaManager substantaActivaManager;
    private UsersManager usersManager;
    private VanzariManager vanzariManager;
    
    public ArhivaManager getArhivaManager()
    {
        if(arhivaManager == null)
        {
            arhivaManager = new ArhivaManager(entityManagerFactory);
        }
        
        return arhivaManager;
    }
    
    public ChitantaManager getChitantaManager()
    {
        if(chitantaManager == null)
        {
            chitantaManager = new ChitantaManager(entityManagerFactory);
        }
        
        return chitantaManager;
    }
    
    public DetaliiChitantaManager getDetaliiChitantaManager()
    {
        if(detaliiChitantaManager == null)
        {
            detaliiChitantaManager = new DetaliiChitantaManager(entityManagerFactory);
        }
        
        return detaliiChitantaManager;
    }
    
    public DetaliiRetetaManager getDetaliiRetetaManger()
    {
        if(detaliiRetetaManager == null)
        {
            detaliiRetetaManager = new DetaliiRetetaManager(entityManagerFactory);
        }
        
        return detaliiRetetaManager;
    }
    
    public MedicamentManager getMedicamentManager()
    {
        if(medicamentManager == null)
        {
            medicamentManager = new MedicamentManager(entityManagerFactory);
        }
        
        return medicamentManager;
    }
    
    public ProducatoriManager getProducatoriManager()
    {
        if(producatoriManager == null)
        {
            producatoriManager = new ProducatoriManager(entityManagerFactory);
        }
        
        return producatoriManager;
    }
    
    public RetetaManager getRetetaManager()
    {
        if(retetaManager == null)
        {
            retetaManager = new RetetaManager(entityManagerFactory);
        }
        
        return retetaManager;
    }
    
    public StocuriManager getStocuriManager()
    {
        if(stocuriManager == null)
        {
            stocuriManager = new StocuriManager(entityManagerFactory);
        }
        
        return stocuriManager;
    }
    
    public SubstantaActivaManager getSubstantaActivaManager()
    {
        if(substantaActivaManager == null)
        {
            substantaActivaManager = new SubstantaActivaManager(entityManagerFactory);
        }
        
        return substantaActivaManager;
    }
    
    public UsersManager getUsersManager()
    {
        if(usersManager == null)
        {
            usersManager = new UsersManager(entityManagerFactory);
        }
        
        return usersManager;
    }
    
    public VanzariManager getVanzariManager()
    {
        if(vanzariManager == null)
        {
            vanzariManager = new VanzariManager(entityManagerFactory);
        }
        
        return vanzariManager;
    }
}
